<template>
   <el-dialog v-model="props.dialogValue" title="创建文件夹名称" width="500" :before-close="handleClose">
        <span>
            <el-form-item>
                <el-input v-model="file" placeholder="请输入你要创建文件夹的名称" />
            </el-form-item>
            <!-- <input type="file" @change="handleFileInput" webkitdirectory mozdirectory /> -->
        </span>
        <template #footer>
            <div class="dialog-footer">
                <el-button @click="cancel">取消</el-button>
                <el-button type="primary" @click="confirm">
                    确定
                </el-button>
            </div>
        </template>
    </el-dialog>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
// import { EleMessage } from 'element-plus'

const router = useRouter()

const props = defineProps({
    dialogValue: Boolean
})

const file = ref('')

const emits = defineEmits(['ChangeDialogVisible','CreateFolder'])

const cancel = () => {
      emits('ChangeDialogVisible')
}

const confirm = () => {
      emits('CreateFolder',file.value)
      console.log(file.value)
      emits('ChangeDialogVisible')
}

const handleClose = () => {
      emits('ChangeDialogVisible')
}

// const  handleFileInput = (event) => {
//       const input = event.target;
//       if (input.files && input.files[0]) {
//         const selectedFolder = input.files[0];
//         // 这里需要一个可以访问文件系统的上下文，例如本地文件系统
//         if ('webkitGetAsEntry' in selectedFolder) {
//           const entry = selectedFolder.webkitGetAsEntry();
//           const folderPath = entry.toURL();
//           const driveLetter = folderPath.substring(0, 2).toUpperCase();
//           const drive = `${driveLetter}:\\`;
//           console.log('文件夹路径：', folderPath);
//           console.log('盘符：', drive);
//           // 你可以在这里处理文件夹路径和盘符
//         }
//       }
//     }
</script>

<style scoped>
</style>
